require('./Pagegsggdetail.less');
import Reflux from 'reflux';
import ReactMixin from 'react-mixin';
import Actions from './Actions'
import Store from './Store';
import { Button,Page, Panel,PanelHeader, PanelBody, PanelFooter,ButtonArea,
  MediaBox,Cells, Cell,CellHeader,MediaBoxTitle,MediaBoxHeader,
  MediaBoxDescription,MediaBoxBody,MediaBoxInfo,MediaBoxInfoMeta,
  CellBody,CellFooter,Toast, Form,FormCell,Radio,Gallery,GalleryDelete,
  Uploader,TextArea,ActionSheet,Flex,FlexItem,SearchBar} from  'react-weui/build/packages'
import {Control} from 'react-keeper';
import yiwancheng  from './../../../assets/img/已完成.png';
import tushen  from './../../../assets/icon/zhzj/图审.png';
import shigong  from './../../../assets/icon/zhzj/施工许可查询.png';
import zhaobiao  from './../../../assets/img/招标公告.png';
import zhongbiao  from './../../../assets/img/中标公告.png';
import hetong  from './../../../assets/img/合同备案.png';


class Gsggdetail extends React.Component {

  constructor(props) {
    super(props);
  }


  render() {
    return (
      <div>
        <MediaBox style={{
          width:"55%",
          float:"left"
        }} type="appmsg">
          <MediaBoxHeader>
            <img src={this.state.gsggdetail.dataType==1?tushen:
              this.state.gsggdetail.dataType==2?shigong:
                this.state.gsggdetail.dataType==3?zhaobiao:
                  this.state.gsggdetail.dataType==4?zhongbiao:
                    this.state.gsggdetail.dataType==5?hetong:null} style={{
              width:30,
              height:30,
              marginTop:15
            }}/>
          </MediaBoxHeader>
          <MediaBoxBody>
            <MediaBoxTitle>{this.state.gsggdetail.dataType==1?"图审":
              this.state.gsggdetail.dataType==2?"施工许可证":
                this.state.gsggdetail.dataType==3?"招标公告":
                  this.state.gsggdetail.dataType==4?"中标公告":
                    this.state.gsggdetail.dataType==5?"合同备案":""}</MediaBoxTitle>
            <MediaBoxDescription style={{
              display:"block"
            }}>
              {this.state.gsggdetail.pdata.time}<br/>
              <span className="pname">{this.state.gsggdetail.pdata.xmmc}</span>
            </MediaBoxDescription>
          </MediaBoxBody>
        </MediaBox>
        <img src={yiwancheng} style={{
          float:"left"
        }}/>

        {
          this.state.gsggdetail.dataType==1?
            <Panel style={{
              float:"left",
              width:"100%"
            }}>
              <PanelHeader style={{
                marginLeft:15
              }}>
                基本信息
              </PanelHeader>
              <PanelBody style={{
                marginLeft:30,
                marginTop:15
              }}>
                施工许可证：{this.state.gsggdetail.pdata.sghtbabh}
                <br/>
                <br/>
                建设地点：{this.state.gsggdetail.pdata.address}
                <br/>
                <br/>
                建筑规模：{this.state.gsggdetail.pdata.jsgmms}
                <br/>
                <br/>
              </PanelBody>

              <PanelHeader style={{
                marginLeft:15
              }}>
                参建五方
              </PanelHeader>
              <PanelBody style={{
                marginLeft:30,
                marginTop:15
              }}>
                建设单位：{this.state.gsggdetail.pdata.org01}
                <br/>
                <br/>
                施工单位：{this.state.gsggdetail.pdata.org05}
                <br/>
                <br/>
                监理单位：{this.state.gsggdetail.pdata.org06}
                <br/>
                <br/>
                设计单位：{this.state.gsggdetail.pdata.org04}
                <br/>
                <br/>
                勘察单位：{this.state.gsggdetail.pdata.org03}
              </PanelBody>
            </Panel>
          :this.state.gsggdetail.dataType==2?
            <Panel style={{
              float:"left",
              width:"100%"
            }}>
              <PanelHeader style={{
                marginLeft:15
              }}>
                基本信息
              </PanelHeader>
              <PanelBody style={{
                marginLeft:30,
                marginTop:15
              }}>
                施工许可证：{this.state.gsggdetail.pdata.sghtbabh}
                <br/>
                <br/>
                建设地点：{this.state.gsggdetail.pdata.address}
                <br/>
                <br/>
                建筑规模：{this.state.gsggdetail.pdata.jsgmms}
                <br/>
                <br/>
              </PanelBody>

              <PanelHeader style={{
                marginLeft:15
              }}>
                参建五方
              </PanelHeader>
              <PanelBody style={{
                marginLeft:30,
                marginTop:15
              }}>
                建设单位：{this.state.gsggdetail.pdata.org01}
                <br/>
                <br/>
                施工单位：{this.state.gsggdetail.pdata.org05}
                <br/>
                <br/>
                监理单位：{this.state.gsggdetail.pdata.org06}
                <br/>
                <br/>
                设计单位：{this.state.gsggdetail.pdata.org04}
                <br/>
                <br/>
                勘察单位：{this.state.gsggdetail.pdata.org03}
              </PanelBody>
            </Panel>
            :this.state.gsggdetail.dataType==3?
            <Panel style={{
              float:"left",
              width:"100%"
            }}>
              <PanelHeader style={{
                marginLeft:15
              }}>
                基本信息
              </PanelHeader>
              <PanelBody style={{
                marginLeft:30,
                marginTop:15
              }}>
                公示时间：{this.state.gsggdetail.pdata.sqrq}
                <br/>
                <br/>
                开始时间：{this.state.gsggdetail.pdata.bmksrq}
                <br/>
                <br/>
              </PanelBody>

              <PanelHeader style={{
                marginLeft:15
              }}>
                参建方
              </PanelHeader>
              <PanelBody style={{
                marginLeft:30,
                marginTop:15
              }}>
                建设单位：{this.state.gsggdetail.pdata.jsdw}
              </PanelBody>
            </Panel>
            :this.state.gsggdetail.dataType==4?
              <Panel style={{
                float:"left",
                width:"100%"
              }}>
                <PanelHeader style={{
                  marginLeft:15
                }}>
                  基本信息
                </PanelHeader>
                <PanelBody style={{
                  marginLeft:30,
                  marginTop:15
                }}>
                  建设地点：{this.state.gsggdetail.pdata.address}
                  <br/>
                  <br/>
                  招标代理机构：{this.state.gsggdetail.pdata.dljg}
                  <br/>
                  <br/>
                  标段号：{this.state.gsggdetail.pdata.coding}
                  <br/>
                  <br/>
                  招标范围：{this.state.gsggdetail.pdata.zbScope}
                  <br/>
                  <br/>
                  项目负责人：{this.state.gsggdetail.pdata.jlr}
                  <br/>
                  <br/>
                  中标范围和内容：{this.state.gsggdetail.pdata.dbyj}
                  <br/>
                  <br/>
                  中标价：{this.state.gsggdetail.pdata.zbjine}
                  <br/>
                  <br/>
                  中标工期：{this.state.gsggdetail.pdata.zbgq}
                  <br/>
                  <br/>
                  质量标准：{this.state.gsggdetail.pdata.zlcn}
                  <br/>
                  <br/>
                  安全标准：{this.state.gsggdetail.pdata.aqcn}
                  <br/>
                  <br/>
                  公示时间：{this.state.gsggdetail.pdata.gssj}
                  <br/>
                  <br/>
                </PanelBody>

                <PanelHeader style={{
                  marginLeft:15
                }}>
                  参建方
                </PanelHeader>
                <PanelBody style={{
                  marginLeft:30,
                  marginTop:15
                }}>
                  建设单位：{this.state.gsggdetail.pdata.jsdw}
                  <br/>
                  <br/>
                  中标单位:{this.state.gsggdetail.pdata.orgName}
                </PanelBody>
              </Panel>
              :this.state.gsggdetail.dataType==5?
                <Panel style={{
                  float:"left",
                  width:"100%"
                }}>
                  <PanelHeader style={{
                    marginLeft:15
                  }}>
                    基本信息
                  </PanelHeader>
                  <PanelBody style={{
                    marginLeft:30,
                    marginTop:15
                  }}>
                    合同备案编号：{this.state.gsggdetail.pdata.zbbabh}
                    <br/>
                    <br/>
                    工程地址：{this.state.gsggdetail.pdata.address}
                    <br/>
                    <br/>
                    招标控制价：{this.state.gsggdetail.pdata.zbkzj}
                    <br/>
                    <br/>
                    合同价：{this.state.gsggdetail.pdata.htjk}
                    <br/>
                    <br/>
                    开工竣工日期：{this.state.gsggdetail.pdata.date}
                    <br/>
                    <br/>
                    合同工期：{this.state.gsggdetail.pdata.htgq}
                    <br/>
                    <br/>
                    工程承包范围：{this.state.gsggdetail.pdata.cbfw}
                    <br/>
                    <br/>
                  </PanelBody>

                  <PanelHeader style={{
                    marginLeft:15
                  }}>
                    参建方
                  </PanelHeader>
                  <PanelBody style={{
                    marginLeft:30,
                    marginTop:15
                  }}>
                    发包单位：{this.state.gsggdetail.pdata.fbdw}
                    <br/>
                    <br/>
                    承包单位：{this.state.gsggdetail.pdata.cbdw}
                    <br/>
                    <br/>
                  </PanelBody>
                </Panel>
                :
                <Panel>
                  <PanelBody>
                    <MediaBox>没有数据</MediaBox>
                  </PanelBody>
                </Panel>
        }
      </div>
    );
  }

  componentWillMount() {
    document.documentElement.scrollTop = 0; //跳转到详情页面让视图一开始保持在顶部
    if(Control.state){
      Actions.loadData(Control.state.dataDetail,Control.state.dataType);
    }
  }

  componentDidMount() {

  }

  componentWillReceiveProps(nextProps) {

  }

  shouldComponentUpdate(nextProps, nextState) {
    const thisProps = this.props || {},
      thisState = this.state.gsggdetail || {};
    if (Object.keys(thisProps).length !== Object.keys(nextProps).length ||
      Object.keys(thisState).length !== Object.keys(nextState).length) {
      return true;
    }

    for (const key in nextProps) {
      if (thisProps[key] !== nextProps[key]) {
        console.log(thisProps[key], nextProps[key]);
        return true;
      }
    }

    for (const key in nextState) {
      if (thisState[key] !== nextState[key]) {
        return true;
      }
    }
    return false;
  }

}

ReactMixin.onClass(Gsggdetail, Reflux.connect(Store, 'gsggdetail'));


export default Gsggdetail ;
